package com.bjwl.web.contrlller.branchstore;

import com.bjwl.pojo.dto.BsadminPowerDto;
import com.bjwl.pojo.vo.BsadminPowerVos;
import com.bjwl.service.BsadminPowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: dzx
 * @Date:Create：in 2020/5/20 17:41
 * @Description:
 * @Modified By：
 * @Version: 1.0
 */
@Controller
@RequestMapping("/bp")
public class BsadminPowerController {

    @Autowired
    private BsadminPowerService bsadminPowerService;

    @RequestMapping("/findBsadminPowerById")
    public String findBsadminPowerById(Integer baid, Model model){
        model.addAttribute("BsadminPower",bsadminPowerService.findBsadminPowerById(baid));
        model.addAttribute("powers",bsadminPowerService.findAllPower());
        return "branch_oa/role";
    }


    @RequestMapping("/updatedBsadminPowerById")
    public @ResponseBody
    boolean updatedBsadminPowerById(@RequestBody BsadminPowerVos vos){

        bsadminPowerService.deleteBsadminPowerById(vos.getId());
        bsadminPowerService.saveBsadminPowerById(vos);

        return true;
    }


}
